package com.VO;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import com.jdbc.dbcon;

public class zhugeVO {
	private int id;
	private String qno;
	private String qdetail;
	private String qexplain;
	
	public  zhugeVO(int id){
		this.setId(id);
		this.getInfo();
		
	}
	
	@Override
	public String toString() {
		return "zhugeVO [id=" + id + ", qno=" + qno + ", qdetail=" + qdetail
				+ ", qexplain=" + qexplain + "]";
	}

	public void getInfo(){
		try{
		Connection c=dbcon.getConnection();
		String sqlstr = "select * from zhugenum where id=?";
		PreparedStatement pst = c.prepareStatement(sqlstr);
		pst.setInt(1, this.id);
		ResultSet rs = pst.executeQuery();
		while (rs.next()){
				this.setQno(rs.getString("qno"));
				this.setQdetail(rs.getString("qdetail"));
				this.setQexplain(rs.getString("qexplain"));
		}
		System.out.println(this.toString());
		c.close();
		}catch(Exception e){
			System.out.println("查询失败："+e.getMessage());
		}
		
	}
	public zhugeVO(){
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getQno() {
		return qno;
	}
	public void setQno(String qno) {
		this.qno = qno;
	}
	
	public String getQdetail() {
		return qdetail;
	}

	public void setQdetail(String qdetail) {
		this.qdetail = qdetail;
	}

	public String getQexplain() {
		return qexplain;
	}
	public void setQexplain(String qexplain) {
		this.qexplain = qexplain;
	}
}
